<%--
    Document   : UserSetting
    Created on : 2011-9-30, 15:16:07
    Author     : Cong
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>View Threads</title>
        <link rel="stylesheet" type="text/css" href="resource/main_page/main-page.css" />
        <script type="text/javascript" src="resource/paintweb/build/paintweb.js"></script>
        <script type="text/javascript" src="resource/tiny_mce/tiny_mce.js"></script>
        <script type="text/javascript" language="JavaScript" src="resource/main_page/main_page.js"></script>
        <script type="text/javascript" language="JavaScript" src="resource/view_threads/thread.js"></script>
        <script type="text/javascript" src="resource/jquery-1.6.2.min.js"></script>
        <script type="text/javascript" >
            tinyMCE.init({
                // Location of TinyMCE script
                mode : "textareas",
                
                // General options
                theme : "advanced",
                plugins : "emotions,contextmenu,paintweb,fmath_formula",
                cleanup : false,
                relative_urls : false,
//                remove_script_host : true,
                paintweb_config : {
                    configFile: "config-example.json",
                    tinymce: {
                        // Tell where PaintWeb is located.
                        paintwebFolder: "resource/paintweb/build/",
                        imageSaveDataURL: true,
                        overlayButton: true,
                        contextMenuItem: true,
                        dblclickHandler: true,
                        pluginBar: true,
                        syncViewportSize: true
                    }
                },
                // Theme options
                theme_advanced_buttons3_add :"emotions,paintwebEdit,fmath_formula",
                theme_advanced_toolbar_location : "top",
                theme_advanced_toolbar_align : "left",
                theme_advanced_statusbar_location : "bottom",
                theme_advanced_resizing : true
            });

            function test(){
                var check = true;
                var content = tinyMCE.getInstanceById("content").getBody().innerHTML;
	        if(content.length<10||content=="<p><br data-mce-bogus=\"1\"></p>")
                {
                     alert("insufficient words of content");
                     check = false;
                }
                return check;
            }

            var counter = 15;

            function show()
            {

                jQuery("#submit").attr("value",counter);
                counter = counter - 1;
                if(counter > 0)
                    setTimeout("show()",1000);
                else
                    changeButton();
            }

            function changeButton()
            {
                jQuery("#submit").removeAttr("disabled");
                jQuery("#submit").attr("value","Submit");
            }
        </script>
    </head>

    <body onkeydown="try{keyCodes(event);}catch(e){}" onload="show()">
        <div class="main-wrap">
            <div id="user-nav">
                <%@ include file="ForumHead.jsp" %>
            </div>
            <div id="main">
                <style type="text/css">
                    .t table tr.tr2 td.f{width:22%;}
                    .t table tr.tr2 td.e{width:10em;}
                </style>
                <div class="forum-info cc gray">
                    <div class="fr"> 
                            welcome, ${session.user.unikey}
                            You may change your <s:a href="UserAction_displayProfileBasic"><b>profile</b></s:a> | <a href="LoginAction_out"><b>Logout</b></a>
                        
                    </div>
                </div>
                <style type="text/css">
                    .sigline {margin-top:10px;margin-left:15px;background: url(resource/view_threads/sigline.gif) right bottom no-repeat;margin-right:30em;height:5px;}
                    .signature {padding:10px 15px 0;height:expression((this.scrollHeight>parseInt(this.currentStyle.maxHeight))?(this.currentStyle.maxHeight):"auto");}
                    .user-pic img {border: 1px solid #d5e6ed;background:#fff;padding:3px;}
                    .small {font-size:12px}
                    .middle {font-size:14px}
                    .big {font-size:18px}
                    .dig{font-size:12px;background-color:#ffffee; background-position:-22px -57px;padding:0 .4em 0 1.6em;cursor: pointer;color:#666;border:1px solid #ffd0a8;height:18px;line-height:18px;margin:12px 5px 10px 15px;}
                    .dig:hover {text-decoration:none;border:1px solid #f5a25c;color:#ff6600;}
                    .readbot {padding:0px;}
                    .readbot a{list-style:none;padding:0 0 0 1.5em;margin:0;float:left;cursor:pointer;background:url(resource/view_threads/yin.gif) no-repeat;width:3.5em;height:16px;}
                    .readbot .r-quote:hover{background-position:0 0;}
                    .readbot .r-reply:hover {background-position:0 -20px;}
                    .readbot .r-score:hover {background-position:0 -40px;}
                    .readbot .r-keep:hover {background-position:0 -60px;}
                    .readbot .r-recommend:hover {background-position:0 -160px;}
                    .readbot .r-report:hover{background-position:0 -200px;}
                    .readbot .r-quote {background-position:0 -80px;}
                    .readbot .r-reply {background-position:0 -100px;}
                    .readbot .r-score {background-position:0 -120px;}
                    .readbot .r-keep {background-position:0 -140px;}
                    .readbot .r-recommend {background-position:0 -180px;}
                    .readbot .r-report {background-position:0 -220px;}
                    .down {background:url(resource/view_threads/down.gif) 5px center no-repeat;padding:5px 5px 5px 30px;border:#c5d8e8 1px solid;margin:0 1em 0 0;line-height:40px;}
                    .threadlist{padding-left:10px;position:absolute;}
                    .threadlist a{display:block;float:left;padding:0 9px;border-bottom:0;line-height:25px;height:25px;}
                    .threadlist .current{ font-weight:700;}
                    .img-50{width:48px;height:48px;}
                    /*分类信息*/
                    .cates{margin:0 0 10px;}
                    .cates .cate-list li{padding:2px 0 1px 10px;font-weight:500;color:#444444; list-style:none;}
                    .cates .cate-list em{ font-style:normal;width:100px;float:left;}
                    .cates .cate-list cite{font-style:normal;}
                    .cates input{ vertical-align:middle;}
                    .cates .w{margin-right:10px;}
                    .cates .two{background:#f3f9fb;}
                    .app-post{background:url(resource/view_threads/app-post.png);display:block;float:left;color:#ffffff;width:78px;height:26px;line-height:25px;padding-left:17px; }
                    .app-post:hover{ text-decoration:none; background-position:0 -50px;}
                    .cate_meg_player {float:right;width:200px;padding:0 10px 9px 0;margin-right:10px;background:#fff;}
                    /*flash*/
                    .flash{position:relative;}
                    .flash img{height:100%;width:100%;}
                    .flash ul {position:absolute;right:8px;bottom:8px;z-index:3;}
                    .flash ul li {list-style:none;float:left;width:18px;height:13px;line-height:13px;text-align:center;margin-left:2px;background:#ffffff;}
                    .flash ul li a {display:block;width:18px;height:13px;font-size:10px;font-family:Tahoma;color:#333333;}
                    .flash ul li a:hover,.flash ul li a.sel {color:#fff;text-decoration:none;background:#ffa900;}
                    /*ping*/
                    .score{margin:10px 15px;padding-top:10px;border-top:1px dashed #d5e6ed;line-height:22px;}
                    .score td{padding:2px 10px 2px 5px;}
                    .score th{padding:6px 0 0;}
                    .score tr:hover{background:#f3f9fb;}
                    .score a{color:#3366cc;}
                    /*overprint*/
                    .overprint_opl a{display:block;float:left;padding:3px;margin:3px}
                    .overprint_opl a.current{border:1px solid #ccc;padding:2px}
                    .overprint_opl a:hover{border:1px solid #ddd;padding:2px;background:#fff9f0}
                    .overprint_opl {height:200px;overflow:auto;}
                    .tipad .fr a{padding:0 0 0 6px;}
                </style>
                <div id="menu_forumlist" style="display:none;">
                    <div class="sbar-box-a" style="width:700px;">
                        <div class="sbar-box-b">
                        </div>
                    </div>
                </div>
                <div id="breadCrumb" class="cc">
                    <s:url id="url_view" value="ThreadAction_listThreads">
                        <s:param name="categoryID" value="categoryID"/>
                        <s:param name="categoryName" value="categoryName"/>
                    </s:url>
                    <s:url id="url_viewThread" value="ThreadAction_viewThread">
                        <s:param name="categoryID" value="categoryID"/>
                        <s:param name="categoryName" value="categoryName"/>
                        <s:param name="threadID" value="threadID"/>
                    </s:url>
                    <img style="cursor:pointer" id="td_cate" src="resource/view_threads/home.gif" align="absmiddle" />
                    <a href="main.jsp" title="ELEC_Forum">ELEC Forum</a> &raquo; <s:a href="%{url_view}">${session.categoryName}</s:a> &raquo; <s:a href="%{url_viewThread}">${thread.threadTitle}</s:a>
                </div>
                <div class="t3 cc">
                    <span class="fr" style="margin-left:.5em"><a href="newThread.jsp"><img src="resource/view_threads/post.png" id="td_post" /></a></span>
                    <s:if test="thread.reply"><span class="fr"><a href="#reply"><img src="resource/view_threads/reply.png" /></a></span></s:if>
                </div>
                                               page <s:property value="now"/> of <s:property value="pageCount"/>&nbsp;&nbsp;
                <s:url id="url_pre" value="ThreadAction_viewThread">
                    <s:param name="categoryID" value="categoryID"/>
                    <s:param name="categoryName" value="categoryName"/>
                    <s:param name="threadID" value="threadID"/>
                    <s:param name="now" value="now-1"/>
                </s:url>
                <s:url id="url_first" value="ThreadAction_viewThread">
                    <s:param name="categoryID" value="categoryID"/>
                    <s:param name="categoryName" value="categoryName"/>
                    <s:param name="threadID" value="threadID"/>
                    <s:param name="now" value="1"/>
                </s:url>
                <s:url id="url_next" value="ThreadAction_viewThread">
                    <s:param name="categoryID" value="categoryID"/>
                    <s:param name="categoryName" value="categoryName"/>
                    <s:param name="threadID" value="threadID"/>
                    <s:param name="now" value="now+1"/>
                </s:url>
                <s:url id="url_last" value="ThreadAction_viewThread">
                    <s:param name="categoryID" value="categoryID"/>
                    <s:param name="categoryName" value="categoryName"/>
                    <s:param name="threadID" value="threadID"/>
                    <s:param name="now" value="pageCount"/>
                </s:url>
                <s:a href="%{url_first}">first</s:a>
                <s:if test="now!=1">
                    <s:a href="%{url_pre}">pre</s:a>
                </s:if>
                <s:if test="now!=pageCount">
                    <s:a href="%{url_next}">next</s:a>
                </s:if>
                <s:a href="%{url_last}">last</s:a>
                <div class="t" style="margin-bottom:0;border-bottom:0;">
                    <table cellspacing="0" cellpadding="0" width="100%">
                        <tr>
                            <td class="tal h" style="border-bottom:0;">
                                Topic : ${thread.threadTitle}
                            </td>
                        </tr>
                    </table>
                </div>
                <input type="hidden" name="fid" value="4" />
                <input type="hidden" name="tid" value="2" />
                <a name=tpc></a>
                <div class="t5" style='border:1px solid #a6cbe7;'>
                    <table cellspacing="0" cellpadding="0" width="100%" style="table-layout:fixed;">
                        <tr>
                            <td style="width:185px;vertical-align:top;" rowspan="2" class="r_two">
                                <div style="padding:8px 0 20px 8px;">
                                    <div class="cc" style="padding-bottom:3px;"><b class="fl black"><a href="" target="_blank">${thread.user.unikey}</a></b>
                                    </div>
                                    <div class="user-pic">
                                        <table style="border:0;">
                                            <tr>
                                                <td width="1">
                                                    <a href="" target="_blank" id="card_sf_tpc_2" class="userCard"><img class="pic" src="UserAction_get_avatar?uni=${thread.user.unikey}" border="0" width="150"/></a>
                                                </td>
                                                <td width="1" style="vertical-align:top"><span id="sf_tpc"></span></td>
                                            </tr>
                                        </table>
                                    </div>
                                </div>
                            </td>
                            <td height="100%" class="r_one" valign="top" id="td_tpc" style="padding:0px;border:0;overflow:hidden"> <a name="post_tpc"></a>
                                <div style="overflow:hidden; position:absolute;margin-left:440px;margin-top:25px;" id="read_overprint">
                                </div>
                                <div class="tiptop cc"><span class="fl">
                                        <b class="fl orange">Author</b>&nbsp;
                                    </span>
                                    <span class="fl gray" style="white-space:nowrap;">Posted on: <s:date name="thread.postDate" format="yyyy-MM-dd HH:mm"/></span>
                                    <span title="" class="fl gray">&nbsp;&nbsp;
                                    </span></div>
                                <div class="tpc_content">
                                    <div class="f14" id="read_tpc">
                                        ${thread.threadContext}
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <tr class="r_one">
                            <td style="vertical-align:bottom;border:0;padding:0;">
                                <div id="w_tpc" class="c"></div>
                                <div class="tipad cc">
                                    <div class="fl readbot">
                                        <s:if test="thread.reply"><a class="r-reply" title="Reply" href="#reply">Reply</a></s:if>
                                        <s:else>this thread cannot be replied</s:else>
                                        <br/>
                                        <div class="fb-like" data-send="false" data-layout="button_count" data-width="550" data-show-faces="true"></div>
                                        <br/>
                                        <a href="https://twitter.com/share" class="twitter-share-button" data-count="horizontal">Tweet</a><script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
                                        </div>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>
                
                <s:iterator value="replies" status="counter">
                    <s:set name="level" value="(now-1)*10 + #counter.count"/>
                    <div class="t5" >
                        <table cellspacing="0" cellpadding="0" width="100%" style="table-layout:fixed;">
                            <tr>
                                <td style="width:185px;vertical-align:top;" rowspan="2" class="r_two">
                                    <div style="padding:8px 0 20px 8px;">
                                        <div class="cc" style="padding-bottom:3px;"><b class="fl black"><a href="" target="_blank">${user.unikey}</a></b>
                                        </div>
                                        <div class="user-pic">
                                            <table style="border:0;">
                                                <tr>
                                                    <td width="1">
                                                        <a href="" target="_blank" id="card_sf_2_2" class="userCard"><img class="pic" src="UserAction_get_avatar?uni=${user.unikey}" border="0" width="150"/></a>
                                                    </td>
                                                    <td width="1" style="vertical-align:top"><span id="sf_2"></span></td>
                                                </tr>
                                            </table>
                                        </div>
                                    </div>
                                </td>
                                <td height="100%" class="r_one" valign="top" id="td_2" style="padding:0px;border:0;overflow:hidden"> <a name="post_2"></a>
                                    <div style="overflow:hidden; position:absolute;margin-left:440px;margin-top:25px;" id="read_overprint">
                                    </div>
                                    <div class="tiptop cc">
                                        <span class="fl">
                                            <b class="fl orange">#  ${level}</b>&nbsp;
                                        </span>
                                        <span class="fl gray"style="white-space:nowrap;">Posted on: <s:date name="replyDate" format="yyyy-MM-dd HH:mm"/></span>
                                        <span title="" class="fl gray">&nbsp;&nbsp;
                                        </span>
                                    </div>
                                    <div class="tpc_content">

                                        <div class="f14" id="read_2">
                                            <s:property value="replyContext" escape="false"/>
                                        </div>


                                    </div>
                                </td>
                            </tr>
                            <tr class="r_one">
                                <td style="vertical-align:bottom;border:0;padding:0;">



                                    <div id="w_2" class="c"></div>
                                    <div class="tipad cc">
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>
                </s:iterator>
                <div class="t3">
                    <span class="fr" style="margin-left:.5em"><a href="newThread.jsp"><img src="resource/view_threads/post.png" id="td_post" /></a></span>
                    <s:if test="thread.reply"><span class="fr"><a href="#reply"><img src="resource/view_threads/reply.png" /></a></span></s:if>
                </div>
                               page <s:property value="now"/> of <s:property value="pageCount"/>&nbsp;&nbsp;
                <s:url id="url_pre" value="ThreadAction_viewThread">
                    <s:param name="categoryID" value="categoryID"/>
                    <s:param name="categoryName" value="categoryName"/>
                    <s:param name="threadID" value="threadID"/>
                    <s:param name="now" value="now-1"/>
                </s:url>
                <s:url id="url_first" value="ThreadAction_viewThread">
                    <s:param name="categoryID" value="categoryID"/>
                    <s:param name="categoryName" value="categoryName"/>
                    <s:param name="threadID" value="threadID"/>
                    <s:param name="now" value="1"/>
                </s:url>
                <s:url id="url_next" value="ThreadAction_viewThread">
                    <s:param name="categoryID" value="categoryID"/>
                    <s:param name="categoryName" value="categoryName"/>
                    <s:param name="threadID" value="threadID"/>
                    <s:param name="now" value="now+1"/>
                </s:url>
                <s:url id="url_last" value="ThreadAction_viewThread">
                    <s:param name="categoryID" value="categoryID"/>
                    <s:param name="categoryName" value="categoryName"/>
                    <s:param name="threadID" value="threadID"/>
                    <s:param name="now" value="pageCount"/>
                </s:url>
                <s:a href="%{url_first}">first</s:a>
                <s:if test="now!=1">
                    <s:a href="%{url_pre}">pre</s:a>
                </s:if>
                <s:if test="now!=pageCount">
                    <s:a href="%{url_next}">next</s:a>
                </s:if>
                <s:a href="%{url_last}">last</s:a>
                <div class="c"></div>
                <div class="t3">
                    <img src="resource/view_threads/home-old.gif" align="absmiddle" />&nbsp;<a href="main.jsp" title="ELEC_Forum">ELEC Forum</a> &raquo; <s:a href="%{url_view}">${session.categoryName}</s:a> &raquo; <s:a href="%{url_viewThread}">${threadTitle}</s:a></div>
                    <s:if test="thread.reply">
                <div class="t">
                    <form name="FORM" method="post" action="ThreadAction_postReply?threadID=${thread.threadId}" onsubmit="return test()">
                        <a name="reply"/>
                        <table width="100%">
                            <tr>
                                <td class="h" colspan="3"><b>Instant Reply</b></td>
                            </tr>
                            <tr class="vt">
                                <td class="f_two" style="width:185px;">
                                    <div class="fp_left">
                                        <div style="_height:26px;">
                                            <p class="b" style="padding:0 0 0 11px;"></p>
                                        </div>
                                        <div class="cc" style="padding-bottom:3px;"><b class="fl black"><a href="" target="_blank">&nbsp;&nbsp;&nbsp;&nbsp;${uni}</a></b>
                                        </div>
                                        <div style="margin:5px 10px;" class="cc">
                                            <div style="background:#fff;padding:2px;border:1px solid #d5e6ed;float:left;"><img class="pic" src="UserAction_get_avatar?uni=${uni}" border="0"  width="150"/></div>
                                        </div>
                                    </div>
                                </td>
                                <td style="background:#fff;">
                                        <textarea id="content" name="replyContent" rows="30" cols="50" style="width: 80%" ></textarea>
                                        <div class="mt10" >
                                            <input class="btn fpbtn" type="submit" name="Submit" id="submit" disabled="disabled" value="15"/>
                                        </div>
                                </td>
                            </tr>
                        </table>
                    </form>
                </s:if>
                </div>
            </div>
        </div>
    </body>
</html>
<script language="JavaScript" src="resource/main_page/fast_access.js"></script>
<%@ include file="ForumFoot.jsp" %>
<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) {return;}
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>